let router = require('../router/Router');

let Token = require('../token');
let ipUtil = require('../util/ipUtil');

let appService = require('../service/AppService');

const {BusiError, SysError} = require('../exception/exception');

/**
 * 用户登录接口
 */
router.post("/app/download", function (req, resp) {
    appService.getDownloadLink(req.body.code, req.body.from).then(res => {
        resp.send({code: 200, msg: "success", data: res});
    }).catch(err => {
        let msg = "系统异常, 请稍后再试";
        if (err instanceof BusiError){
            msg = err.message;
        }
        resp.send({code: 500, msg: msg});
    });
});